#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<string>
#include<vector>
using namespace std;

int multiply(int A, int B) {
    if (A > B) return multiply(B, A);
    if (A == 1) return B;
    return B + multiply(A - 1, B);
}

int minSubArrayLen(int target, vector<int>& nums) {
    int cnt = INT_MAX;
    int left = 0, right = 0;
    int sum = 0;
    int n = nums.size();
    int s = 0;
    for (int left = 0, right = 0; right < n; ++right)
    {
        sum += nums[right];
        while (sum >= target)
        {
            cnt = min(cnt, right - left + 1);
            sum -= nums[left++];
        }
    }
    return cnt == INT_MAX ? 0 : cnt;
}

int wiggleMaxLength(vector<int>& nums) {
    int n = nums.size();
    if (n == 1)
        return 1;
    int ret = 1;
    int left = 0, right = 0;
    for (int i = 0; i < n - 1; ++i)
    {
        right = nums[i + 1] - nums[i];
        if (right == 0) continue;
        if (left * right <= 0) ++ret;
        left = right;
    }
    return ret;
}

void Sevennum() {
    int n;
    cin >> n;
    int cnt = 0;
    for (int i = 1; i <= n; ++i)
    {
        if (i % 7 == 0) ++cnt;
        else {
            string str = to_string(i);
            auto pos = str.find('7');
            if (pos != str.npos) ++cnt;
        }
    }
    cout << cnt << endl;
    return;
}
